import com.cc.util.PropertiesLoader;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.Protocol;
import redis.clients.jedis.exceptions.JedisException;

public class RedisDemo {
	public static void main(String[] args) {
		PropertiesLoader loader = new PropertiesLoader("jdbc.properties");
		// 读取属性文件jedis_config.properties
		String jedis_ip = loader.getProperty("jedis_ip");
		String jedis_port = loader.getProperty("jedis_port");
		// 池基本配置
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxIdle(5);
		config.setMaxWaitMillis(100000l);
		config.setTestOnBorrow(false);
		JedisPool jedisPool = new JedisPool(config, jedis_ip, Integer.valueOf(jedis_port), Protocol.DEFAULT_TIMEOUT);
		Jedis jedis = null;
		try {
			jedis = jedisPool.getResource();
			
			String string = jedis.get("a");
			
			System.out.println(string);
		} catch (JedisException e) {
			System.out.println("==");
			e.printStackTrace();
		}
	}
}
